using System;
using System.Data;
using System.Collections.Generic;
using Soccer.Core;
using Soccer.Utility;

namespace Soccer.Business
{
    [TableAttribute("Tournaments")]
	[Serializable]
    public class Tournament : DBO<Tournament>
    {
		#region Fields
		
		private int? _IdTournament;
		private string _TourName;
		private int? _IdCountryTournament;
		private int? _SortOrder;
		private bool? _IsActived;
		
		#endregion
		
		#region Constructors
		/// <summary>
		/// Default constructor
		/// </summary>
		public Tournament()
		{
			
		}
		
		/// <summary>
		/// Constructor with IdTournament 
		/// </summary>
		/// <param name="IdTournament">The IdTournament</param>
		public Tournament(int? IdTournament )
		{
			this.IdTournament = IdTournament;
		}
		
		/// <summary>
		/// Constructor with all parameters
		/// </summary>
		/// <param name="IdTournament">Sets int? value for IdTournament</param>
		/// <param name="TourName">Sets string value for TourName</param>
		/// <param name="IdCountryTournament">Sets int? value for IdCountryTournament</param>
		/// <param name="SortOrder">Sets int? value for SortOrder</param>
		/// <param name="IsActived">Sets bool? value for IsActived</param>
		public Tournament(int? idTournament, string tourName, int? idCountryTournament, int? sortOrder, bool? isActived)
		{
			this.IdTournament = idTournament;
			this.TourName = tourName;
			this.IdCountryTournament = idCountryTournament;
			this.SortOrder = sortOrder;
			this.IsActived = isActived;
		}
		
		#endregion
		
		#region Properties
		
		/// <summary>
		/// Gets or sets int? value for IdTournament
		/// </summary>
		[ColumnAttribute("IdTournament", SqlDbType.Int , 4 , true, true, false)]
		public int? IdTournament
		{
			set
			{
				this._IdTournament = value;
			}
			get
			{
				return this._IdTournament;
			}
		}
		
		/// <summary>
		/// Gets or sets string value for TourName
		/// </summary>
		[ColumnAttribute("TourName", SqlDbType.NVarChar , 100 , false, false, true)]
		public string TourName
		{
			set
			{
				this._TourName = value;
			}
			get
			{
				return this._TourName;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdCountryTournament
		/// </summary>
		[ColumnAttribute("IdCountryTournament", SqlDbType.Int , 4 , false, false, true)]
		public int? IdCountryTournament
		{
			set
			{
				this._IdCountryTournament = value;
			}
			get
			{
				return this._IdCountryTournament;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for SortOrder
		/// </summary>
		[ColumnAttribute("SortOrder", SqlDbType.Int , 4 , false, false, true)]
		public int? SortOrder
		{
			set
			{
				this._SortOrder = value;
			}
			get
			{
				return this._SortOrder;
			}
		}
		
		/// <summary>
		/// Gets or sets bool? value for IsActived
		/// </summary>
		[ColumnAttribute("IsActived", SqlDbType.Bit , 1 , false, false, true)]
		public bool? IsActived
		{
			set
			{
				this._IsActived = value;
			}
			get
			{
				return this._IsActived;
			}
		}
		
		
		/// <summary>
		/// Get a CountryTournament of current Tournament object base on IdCountryTournament
		/// </summary>
		public CountryTournament CountryTournament
		{
			get
			{
				if (this.IdCountryTournament == null)
					return null;
	
				CountryTournament condition = new CountryTournament(this.IdCountryTournament);
				return CountryTournamentController.FindItem(condition);
			}
		}
		
		/// <summary>
		/// Get a list Season of current Tournament object base on IdTournament
		/// </summary>
		public List<Season> SeasonListForIdTournament
		{
			get
			{
				if (this.IdTournament == null)
					return null;
				Season condition = new Season();
				condition.IdTournament = this.IdTournament;
				return SeasonController.FindItems(condition);
			}
		}
		
		/// <summary>
		/// Get a list TournamentGroupTournament of current Tournament object base on IdTournament
		/// </summary>
		public List<TournamentGroupTournament> TournamentGroupTournamentListForIdTournament
		{
			get
			{
				if (this.IdTournament == null)
					return null;
				TournamentGroupTournament condition = new TournamentGroupTournament();
				condition.IdTournament = this.IdTournament;
				return TournamentGroupTournamentController.FindItems(condition);
			}
		}
		
		#endregion
        
        #region Other Properties
        private static ColumnNameStruct? _ColumnName;
        public static ColumnNameStruct ColumnName
        {
            get
            {
                if (!_ColumnName.HasValue)
                    _ColumnName = new ColumnNameStruct();
                return _ColumnName.Value;
            }
        }
        #endregion

        #region NestedType
        public  struct ColumnNameStruct
        {
            /// <summary>
            /// Get the name of column [IdTournament]
            /// </summary>
            public string IdTournament
            {
                get
                {
                    return "IdTournament";
                }
            }
            /// <summary>
            /// Get the name of column [TourName]
            /// </summary>
            public string TourName
            {
                get
                {
                    return "TourName";
                }
            }
            /// <summary>
            /// Get the name of column [IdCountryTournament]
            /// </summary>
            public string IdCountryTournament
            {
                get
                {
                    return "IdCountryTournament";
                }
            }
            /// <summary>
            /// Get the name of column [SortOrder]
            /// </summary>
            public string SortOrder
            {
                get
                {
                    return "SortOrder";
                }
            }
            /// <summary>
            /// Get the name of column [IsActived]
            /// </summary>
            public string IsActived
            {
                get
                {
                    return "IsActived";
                }
            }
        }
        #endregion
    }
}
